package com.shanks.framework.mq.demo.service.impl;

import com.shanks.framework.mq.demo.builder.MessageBuilder;
import com.shanks.framework.mq.demo.constant.MQConstant;
import com.shanks.framework.mq.demo.service.DemoService;
import com.shanks.framework.mq.model.MessageRecordPO;
import com.shanks.framework.mq.service.MessageQueueService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class DemoServiceImpl implements DemoService {
    @Resource
    private MessageQueueService messageQueueService;

    @Override
    public void send(Long orderId) {
        MessageRecordPO messageRecordPO = MessageBuilder.buildMessage(MQConstant.TOPIC.TOPIC_CHANGE_ORDER_STATUS, MQConstant.TAG.TAG_CHANGE_ORDER_STATUS, orderId.toString());
        messageQueueService.insertAndOfferMessage(messageRecordPO);
    }
}
